#define  _CRT_SECURE_NO_WARNINGS 1



#include<iostream>
using namespace std;


#include <stdio.h>
#include <string.h>
int main()
{
    int m, n;
    int a=0;
    cin >> m >> n;
    int t = 0;
    if (m < n)
    {
        t = m;
        m = n;
        n = t;
    }
    int b = n;
    while (1)
    {
        n = n - 1;
        if (m % n == 0 && b % n == 0)
            break;
    }
    while (1)
    {
        if (m % n > 0)
        {
            m = m + 1;
            a = m;
        }
        else
            break;
    }
    cout << a << " " << n;
    system("pause");
    return 0;
}
